home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / pyshared / pyatspi / __init__.py next >
Encoding:
Python Source  |  2009-03-17  |  2.5 KB  |  74 lines

  1. '''
  2. Wraps the Gnome Assistive Technology Service Provider Interface for use in
  3. Python. Imports the bonobo and ORBit modules. Initializes the ORBit ORB.
  4. Activates the bonobo Accessibility Registry. Loads the Accessibility typelib
  5. and imports the classes implementing the AT-SPI interfaces.
  6.  
  7. @var Registry: Reference to the AT-SPI registry daemon intialized on successful
  8.   import
  9. @type Registry: registry.Registry
  10.  
  11. @author: Peter Parente
  12. @organization: IBM Corporation
  13. @copyright: Copyright (c) 2005, 2007 IBM Corporation
  14. @license: LGPL
  15.  
  16. This library is free software; you can redistribute it and/or
  17. modify it under the terms of the GNU Library General Public
  18. License as published by the Free Software Foundation; either
  19. version 2 of the License, or (at your option) any later version.
  20.  
  21. This library is distributed in the hope that it will be useful,
  22. but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  24. Library General Public License for more details.
  25.  
  26. You should have received a copy of the GNU Library General Public
  27. License along with this library; if not, write to the
  28. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  29. Boston, MA 02111-1307, USA.
  30.  
  31. Portions of this code originally licensed and copyright (c) 2005, 2007
  32. IBM Corporation under the BSD license, available at
  33. U{http://www.opensource.org/licenses/bsd-license.php}
  34. '''
  35.  
  36. __version__ = (1, 26, 0)
  37.  
  38. REGISTRY_IID = "OAFIID:Accessibility_Registry:1.0"
  39. TYPELIB_NAME = "Accessibility"
  40.  
  41. # import ORBit and bonobo first (required)
  42. import ORBit, bonobo
  43. # initialize the ORB
  44. orb = ORBit.CORBA.ORB_init()
  45. # get a reference to the gnome Accessibility registry
  46. try:
  47.   reg = bonobo.activation.activate_from_id(REGISTRY_IID, 0, 0)
  48. except Exception:
  49.   reg = None
  50. # generate Python code for the Accessibility module from the IDL
  51. ORBit.load_typelib(TYPELIB_NAME)
  52.  
  53. # import our registry module
  54. import registry
  55. # wrap the raw registry object in our convenience singleton
  56. Registry = registry.Registry(reg)
  57. # overwrite the registry class in the module, so all other imports get our
  58. # singleton
  59. registry.Registry = Registry
  60. # now throw the module away immediately
  61. del registry
  62.  
  63. # pull the cache level functions into this namespace, but nothing else
  64. from accessible import setCacheLevel, getCacheLevel, clearCache, printCache
  65.  
  66. # pull constants and utilities directly into this namespace; rest of code
  67. # never has to be touched externally
  68. from constants import *
  69. from utils import *
  70.  
  71. # throw away extra references
  72. del reg
  73. del orb
  74.